﻿using System;
using fit;

namespace ScrumBox.AcceptanceTests.HelloWorld
{
    /// <summary>
    /// AnalyseText
    /// </summary>
    public class AnalyseText : ColumnFixture
    {
        public string input;
        private TextMachine tm;

        public int words
        {
            get { return tm.words; }
        }

        public int chars
        {
            get { return tm.chars; }
        }


        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public bool calculate()
        {
            tm = new TextMachine(input);
            return true;
        }
    }

    internal class TextMachine
    {
        public int chars;
        public int words;

        public TextMachine(String text)
        {
            chars = text.Length;
            words = text.Split(", \r\n\t".ToCharArray(),
                               StringSplitOptions.RemoveEmptyEntries).Length;
        }
    }
}